<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>transform</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C++ Algorithms</a> &gt; <a href=
    "transform.html">transform</a>
  </div>

  <div class="name-format">
    transform
  </div>

  <div class="syntax-name-format">
    Syntax:
  </div>
  <pre class="syntax-box">
  #include &lt;algorithm&gt;
  iterator transform( iterator start, iterator end, iterator result, UnaryFunction f );
  iterator transform( iterator start1, iterator end1, iterator start2, iterator result, BinaryFunction f );
</pre>

  <p>The transform() algorithm applies the function <em>f</em> to some
  range of elements, storing the result of each application of the
  function in <em>result</em>.</p>

  <p>The first version of the function applies <em>f</em> to each
  element in [<em>start</em>,<em>end</em>) and assigns the first output
  of the function to <em>result</em>, the second output to
  (<em>result</em>+1), etc.</p>

  <p>The second version of the transform() works in a similar manner,
  except that it is given two ranges of elements and calls a binary
  function on a pair of elements.</p>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    <a href="copy.html">copy</a><br>
    <a href="fill.html">fill</a><br>
    <a href="generate.html">generate</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
